// areaview.h : Defines the game state that is where most gameplay will occur, in the 4-split screen
// adventure environment
//$Id: AreaView.h 26 2009-08-21 04:33:58Z brwarner2 $

#pragma once
#include "gamestate.h"

//Object manager
class CObjectManager;
#include "ObjectManager.h"

//Component Manager
class CComponentManager;

//Area class
class CArea;

//Area view game state class
class CAreaView :
	public IGameState
{
public:
	//Constructor
	CAreaView(void);

	//Destructor
	virtual ~CAreaView(void);

	//Entrance function
	void OnEnter( const std::string &prev );

	//Render function
	void Render( void );

	//Renders a specific area
	void RenderTarget( bug::render::IRenderDevice*, unsigned int area );

	//Update function
	void Update( float fElapsed, float fTotal );

	//Gets the active player ID
	unsigned int GetActivePlayerID( void ) { return m_nActiveScreen; }

	//Sets the active area for a player
	void SetPlayerArea( unsigned int player, CArea* pArea );

private:
	//Object manager
	CObjectManager* m_pObjects;

	//Component manager
	CComponentManager* m_pComponents;

	//GM Machine
	gmMachine* m_pGM;

	//Areas
	std::vector<CArea*> m_areas;

	//Active areas
	CArea* m_activeAreas[4];

	//Area render surfaces
	bug::render::TexturePointer m_targets[4];

	//Target skins
	bug::render::SkinPointer m_targetSkins[4];

	//Active screen ID
	unsigned int m_nActiveScreen;

	//Area table list
	gmTableObject* m_pAreaList;

	//Active and inactive borders
	bug::render::SkinPointer m_inactive, m_active;
};
